package com.etime.perfectschool.controller;

import com.etime.perfectschool.pojo.ActiviesComments;
import com.etime.perfectschool.pojo.NewsComments;
import com.etime.perfectschool.service.ActiviesCommentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
public class ActiviesCommentsController {
    @Autowired
    private ActiviesCommentsService activiesCommentsService;

    @GetMapping("/getAllActiviesComments")
    public List<ActiviesComments> getAllActiviesComments(int activityId)
    {
        List<ActiviesComments> allActiviesComments = activiesCommentsService.getAllActiviesComments(activityId);
        return allActiviesComments;
    }

    //评论
    @PostMapping("/addActiviesComments")
    public int addActiviesComments(ActiviesComments activiesComments)
    {
        return  activiesCommentsService.addActiviesComments(activiesComments);
    }

    //    删除某条活动的全部评论
    @DeleteMapping("/deleteActiviesCommentsByactivityId")
    public boolean deleteActiviesCommentsByactivityId(int activityId)
    {
        return activiesCommentsService.deleteActiviesCommentsByactivityId(activityId);
    }
}
